home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 450 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.9 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: austern@isolde.mti.sgi.com (Matt Austern)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Template specialization with template?
  5. Date: 22 Feb 1996 20:29:03 GMT
  6. Organization: SGI
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <AUSTERN.96Feb22095224@isolde.mti.sgi.com>
  9. References: <312BF6A1.5BBE@bnr.ca>
  10. Reply-To: austern@cardboard.mti.sgi.com
  11. NNTP-Posting-Host: taumet.eng.sun.com
  12. Content-Type: text
  13. X-Nntp-Posting-Host: isolde.mti.sgi.com
  14. In-Reply-To: "nicolas's message of 22 Feb 1996 09:13:53 PST
  15. Content-Length: 975
  16. X-Lines: 26
  17. Originator: clamage@taumet
  18.  
  19. In article <312BF6A1.5BBE@bnr.ca> "nicolas (n.) chapados" <chapados@bnr.ca> writes:
  20.  
  21. > It sometimes would be useful to have a template specialization be
  22. > itself a template.  For example, to define persistent I/O on all
  23. > vectors of type T, one could specialize PersistentIO<T>:
  24. >     template <class T>
  25. >     class PersistentIO< vector<T> >
  26. >     { ... };
  27. > I'd like to know whether this is allowed by the current draft.
  28. > Given the affirmative, what does the T argument represent inside
  29. > the specialization?
  30.  
  31. Yes, this is allowed.  (So long as an unspecialized version of
  32. PersistentIO<X> has been declared first.)  This is known as partial
  33. specialization, and it is described in section 14.6 [temp.class.spec]
  34. of the draft standard.  Partial specialization is used in the standard
  35. class library.
  36.  
  37. Unfortunately, I don't know of any released compilers that have
  38. actually implemented partial specialization.
  39. -- 
  40. Matt Austern
  41. SGI: MTI Compilers Group
  42. austern@isolde.mti.sgi.com
  43.  
  44. [ To submit articles: Try just posting with your newsreader.
  45.               If that fails, use mailto:std-c++@ncar.ucar.edu
  46.   FAQ:    http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  47.   Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  48.   Comments? mailto:std-c++-request@ncar.ucar.edu
  49. ]
  50.